%1
p=[-pi:pi/18:pi];
b = sin(p)
%2
a = rand(10)
b = 0; 
for i=1:1:10
    for j=1:1:10
        if(a(i,j)>=0.6)
            b=b+1;
        end 
    end 
end 
b



%3
a = rand(10)
b = 0; 
for i=1:1:10
    for j=1:1:10
        if(0.6>a(i,j)>0.4 )
            b=b+1;
        end 
    end 
end 
b
%4
a = randi(3,10,10);
b = zeros(30,1);
k=0;
for i=1:1:10
    for j=1:1:10
        if(a(i,j)>1 )
            k=k+1;
            b(k,1)= a(i,j);
        end 
    end 
end 
b
k

%5
A= [1 2 3;
    4 5 6]
B= [2 4 0;
    1 3 5]
D = [1 4 7;
    8 5 2;
    3 6 0]
c = A'* B
N = A * B'
F = D\A;%矩阵维度不匹配
M = A * B;%矩阵维度不匹配

%6
U = [100 120 140 160 180 200];
I = [0.45 0.55 0.60 0.70 0.80 0.85];
R = U./I

%7
A= [1 2 3 4];
B = [0.1 0.3 0.5 0.1];
                      %C = randsrc(10,1,[1:4;0.1 0.3  0.5 0.1])
C = zeros(1,10);
x = rand(1,10);
C(find(x<0.1))=1;
C(find(x>=0.1))=2;
C(find(x>=0.4))=3;
C(find(x>=0.9))=4;
C
%7 
A= [1 2 3 4];
B = [0.1 0.3 0.5 0.1];                    %C = randsrc(10,1,[1:4;0.1 0.3  0.5 0.1])
c = zeros(1,10);
x = rand(1,10);
for i=1:1:10
    if(x(i)<0.1)
        c(i)= 1;
    elseif(0.4>x(i)>0.1)
        c(i)= 2;
    elseif(0.9>x(i)>0.4)
        c(i)= 3;
    elseif(1>x(i)>0.9)
        c(i)= 4;
    end
end
c


